package com.example.sportplay.controller;

import com.alibaba.fastjson.JSON;
import com.example.sportplay.bean.User;
import com.example.sportplay.dao.CarDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;


@RestController
public class ProductionController {

    @Autowired
    private CarDao carDao;
    @CrossOrigin
    @RequestMapping("/production")
    public String getProduction(){






        List<User> cars = carDao.getProductionCar();
        HashMap<String, Object> res = new HashMap<>();

        res.put("data",cars);

        String users_json = JSON.toJSONString(res);
        System.out.println("adasdsafffffffffffffffsacs");
        System.out.println(cars);
        return users_json;
    }


}
